/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2024-05-31
 * Time: 18:05
 */
public class Main {
    public static String removeDuplicates(int[] nums) {
        //删除重复的数字
        StringBuilder st=new StringBuilder();
        if(nums!=null) st.append(nums[0]);
        else return " ";
        for (int i = 1; i < nums.length; i++) {
            if(nums[i]+'0'==st.charAt(st.length()-1)) ;
            else st.append(nums[i]);
        }
        return st.toString();
    }


    public static void main(String[] args) {
        int[] nums={1,1,2};
        System.out.println(removeDuplicates(nums));
    }
    public static boolean isValid(String s) {
        char[] ch=s.toCharArray();
        StringBuilder st = new StringBuilder();
        for (int i = 0; i < ch.length; i++) {
            if(ch[i]=='('||ch[i]=='['||ch[i]=='{'){
                st.append(ch[i]);
            } else if (st.length()!=0&&(ch[i] + st.charAt(st.length() - 1) == '('+')'||
                    ch[i] + st.charAt(st.length() - 1) == '['+']' ||
                    ch[i] + st.charAt(st.length() - 1) == '{'+'}')) {
                st.deleteCharAt(st.length()-1);
            }else{
                return false;
            }
        }
        if(st.length()==0) return true;
        else return false;
    }
    public static void main1(String[] args) {
        //括号问题
        //模仿栈的实现
        System.out.println(isValid("]"));

    }
}